package com.hkd.user_service.api.fallback;

import com.hkd.common.api.ApiResponse;
import com.hkd.common.api.BaseFallBack;
import com.hkd.common.api.BaseFallbackFactory;
import com.hkd.user_service.api.SysRoleService;
import com.hkd.user_service.api.entity.SysRole;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author HKD
 * @date 2022/9/4 16:51
 */
@Component
public class SysRoleServiceImplFallback extends BaseFallbackFactory<SysRoleService> {
    @Override
    public SysRoleService create(Throwable throwable) {
        FeignFallback fallback = new FeignFallback();
        fallback.setCause(throwable);
        return fallback;
    }

    public class FeignFallback extends BaseFallBack implements SysRoleService {


        @Override
        public ApiResponse insertRole(SysRole role) {
            return defaultFallBack();
        }

        @Override
        public ApiResponse<List<String>> getRoleByUserId(String id) {
            return defaultFallBack();
        }

        @Override
        public ApiResponse<List<String>> getAuthPathByUserId(String userId) {
            return defaultFallBack();
        }
    }
}
